home *** CD-ROM | disk | FTP | other *** search
- unit Unit1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- DropFile, ComCtrls, StdCtrls, ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Image1: TImage;
- Memo1: TMemo;
- Label1: TLabel;
- StatusBar1: TStatusBar;
- DropFile1: TDropFile;
- procedure DropFile1FileDrop(Sender: TObject; Filename: string);
- procedure FormShow(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
-
- procedure TForm1.DropFile1FileDrop(Sender: TObject; Filename: string);
- var
- F: TextFile;
- S: string;
- begin
- memo1.clear;
- AssignFile(F, FileName); { FileName returned from TDropFile component }
- StatusBar1.SimpleText:= fileName + ' was dropped';
- Reset(F);
- while not EOF(F) do
- begin
- Readln(F, S); { Read the first line out of the file }
- Memo1.Lines.add(S); { Put string in a TMemo control }
- end;
- CloseFile(F);
- end;
-
- procedure TForm1.FormShow(Sender: TObject);
- begin
- DropFile1.enableDropFile(form1.handle);
- end;
-
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- dropFile1.disableDropFile;
- end;
-
- end.
-